<template>
  <div class="public_main">
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>{{$t('dashBoard.no2')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('dashBoard.no5')}}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>

    <!-- -------------搜索查询栏------------------------ -->
    <search 
      :searchData="searchData" 
      @search="search" 
      :searchRight="true"
      
    ></search>
    <!-- :outputRight="$store.state.common.permiss.includes('RIGHT_ACCOUNT_LENDING_EXP')" -->

    <!-- -------------表格数据开始------------------------ -->
    <!-- <div class="table" v-if="$store.state.common.permiss.includes('RIGHT_ACCOUNT_LENDING_LIST')"> -->
    <div class="table">
      <el-table :data="tableData" stripe size="small" :summary-method="getSummaries" show-summary>
        <el-table-column align="center" prop="date" :label="$t('public.no33')"></el-table-column>
        <el-table-column align="center" prop="partnerNo" :label="$t('merchantList.no8')"></el-table-column>
        <el-table-column align="center" prop="partnerName" :label="$t('merchantList.no1')"></el-table-column>
        <el-table-column align="center" prop="registeredCount" :label="$t('public.registerUser')"></el-table-column>
        <el-table-column align="center" prop="applicationCount" :label="$t('merchantList.no47')"></el-table-column>
        <el-table-column align="center" prop="loanCount" :label="$t('merchantList.no48')"></el-table-column>
        <el-table-column align="center" prop="maturityCount" :label="$t('merchantList.no49')"></el-table-column>
        <el-table-column align="center" prop="repaymentCount" :label="$t('merchantList.no50')"></el-table-column>
      </el-table>
    </div>
    <!-- ------------  分页显示栏  ------------------------ -->
    <el-row type="flex" justify="end">
      <div class="pages" >
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page="pagination.current"
          layout="sizes, prev, pager, next, total,->"
          :page-sizes="pagination.pageSizeOptions"
          :page-size="pagination.pageSize"
          @size-change="handleSizeChange"
          :total="pagination.total">
        </el-pagination>
      </div>
    </el-row>

    <div class="foot"></div>

  </div>
</template>
<script>
export default {
  name: 'merchantListBusiness',
  data () {
    const searchData=[
      {
        type: 'input',
        label: 'merchantList.no1',
        attr: 'partnerName',
        value: ''
      },{
        type: 'input',
        label: 'merchantList.no51',
        attr: 'repeatCount',
        value: ''
      },{
        type: 'rangePicker',
        label: 'public.no33',
        attr: 'searchTime',
        value: [],
      },
    ]
    return {
      flag: true,
      loadFlag: true,
      pagination: {
        pageSize: global.config.pageSize,
        pageSizeOptions: global.config.pageSizeOptions,
        current: 1,
        total: 0,
      },
      searchData:searchData,
      formInline: {},// 用户查询信息数据对应字段
      tableData: [],// 表格数据
      option1: this.$store.state.options.merchantListUserType_option
    }
  },
  methods: {
    handleSizeChange (val) {// 每页条数变化时操作
      this.pagination.pageSize = val;
      this.getTableData();
    },
    handleCurrentChange (val) { // 分页按钮点击操作
      this.pagination.current = val;
      this.getTableData();
    },
    search(search) { // 搜索
      this.formInline = {
        partnerName: search.partnerName,
        repeatCount:search.repeatCount,
        startDate: search.searchTime?search.searchTime[0]:'',
        endDate: search.searchTime?search.searchTime[1]:'',
      };
      this.pagination.current = 1;
      this.getTableData();
    },
    getTableData () { // 列表数据获取
      this.loadFlag = true;
      let option = {
        pageNum:this.pagination.current,
        pageSize:this.pagination.pageSize,
        param: {
          ...this.formInline
        }       
      }
      this.$axios.post(this.$action.business_list, option).then(res => {
        if (res.code == 200) {
          this.tableData = res.data.list;
          this.pagination.total = res.data.total;
        }else{
          this.$globalMsg.error(res.message)
        }
        this.loadFlag = false;
      })
    },
    getSummaries() {// 总和
      let sums = [];
      return sums;
    },
  },
  mounted () {
    this.getTableData();
  }
}
</script>
<style scoped lang="scss">

</style>
